# Servo Control Example
#
# This example shows how to use your OpenMV Cam to control servos.

import time,pyb
from pyb import Servo

s1 = Servo(1) # P7 左右控制
s2 = Servo(2) # P8 上下控制
led = pyb.LED(2) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4.
s1.angle(0) #舵机1转动到0°
led.on()            #亮灯
time.sleep_ms(1000)
led.off()
s1.angle(90) #舵机1转动到90°

time.sleep_ms(1000)

s2.angle(0) #舵机1转动到45°
led.on()            #亮灯
time.sleep_ms(1000)

led.off()
s2.angle(90) #舵机2转动到135°
time.sleep_ms(1000)

while(True):
    led.on()            #亮灯
